//package com.qf.strategy.service.Impl;
//
//import com.qf.strategy.service.DataFilterManager;
//import com.qf.strategy.service.FilterChain;
//import com.qianfeng.smsplatform.common.model.Standard_Submit;
//import org.slf4j.Logger;
//import org.slf4j.LoggerFactory;
//import org.springframework.beans.factory.annotation.Autowired;
//import org.springframework.beans.factory.annotation.Value;
//import org.springframework.cloud.context.config.annotation.RefreshScope;
//import org.springframework.stereotype.Service;
//
//import java.io.IOException;
//import java.util.Map;
//import java.util.zip.DataFormatException;
//
///**
// * @author 徐老板
// * @date 2020/2/27   11:01
// */
//@Service
//@RefreshScope//这个是配合config bus的
////这里注释掉 方便从redis中读配置
//public class DataFilterManagerImpl implements DataFilterManager {
//    private static final Logger LOGGER = LoggerFactory.getLogger(DataFilterManager.class);
//    @Autowired
//    private Map<String, FilterChain> filterChainMap;
//    @Value("${smsplatform.filters}")
//    private String filters;
//
//    @Override
//    public void dealSms(Standard_Submit submit) {
//
//        //需要拿到所有过滤器 挨个调用
//        String[] splits = filters.split(",");
//        if (splits!=null&&submit!=null){
//        for (String split : splits) {
//            try {
//                FilterChain filterChain = filterChainMap.get(split);
//                boolean b = filterChain.dealSms(submit);
//                if (!b){ break;}
//            } catch (DataFormatException e) {
//                //如果不用异常捕捉器就用这个catch 不过感觉不然异常捕捉器好用
//                e.printStackTrace();
//                LOGGER.error("过滤器发生异常 错误信息是{}",e.getMessage());
//            } catch (IOException e) {
//                e.printStackTrace();
//            }
//        }
//        }
//
//    }
//
//
//}
